import request from "@/request";
// 登录
export const login = (data) => {
	return request({
		url: `/api/member/login`,
		method: "POST",
		toastLoading: true,
		data
	});
};
// 获取验证码
export const get_code = (data) => {
	return request({
		url: `/api/member/verification/code`,
		method: "POST",
		toastLoading: true,
		data
	});
};
// 重置密码
export const reset_password = (data) => {
	return request({
		url: `/api/member/updatePw/by/captcha`,
		method: "POST",
		toastLoading: true,
		data
	});
};
// 注册
export const register_api = (data) => {
	return request({
		url: `/api/member/register`,
		method: "POST",
		toastLoading: true,
		data
	});
};

// 查询登录用户的最新检查记录
export const checkLogin = (data) => {
	return request({
		url: `/api/member/examination/getLatest/by/login`,
		method: "POST",
		toastLoading: false,
		loading: false,
		data
	});
};

// 获取用户基础信息
export const getUserInfoApi = (data) => {
	return request({
		url: `/api/member/info`,
		method: "GET",
		toastLoading: false,
		loading: false,
		data
	});
};

// 创建眼科检查记录
export const createExamination = (data) => {
	return request({
		url: `/api/member/examination/create`,
		method: "POST",
		toastLoading: false,
		data 
	});
};

// 更新眼科检查记录
export const updateExamination = (data) => {
	return request({
		url: `/api/member/examination/update/${data}`,
		method: "POST",
		toastLoading: false,
	});
};


// 获取视频列表
export const videoListApi = (data) => {
	return request({
		url: `/api/member/file/list`,
		method: "POST",
		toastLoading: false,
		loading: false,
		data
	});
};

// 获取视频详情
export const videoDetailApi = (data) => {
	return request({
		url: `/api/member/video/view/get/last/${data}`,
		method: "GET",
		toastLoading: false,
	});
};


// 更新视频进度
export const saveVideoApi = (data) => {
	return request({
		url: `/api/member/video/view/save`,
		method: "POST",
		toastLoading: false,
		loading: false,
		data
	});
};

// 上传
export const uploadApi = (data) => {
	return request({
		url: `/api/manage/upload`,
		method: "POST",
		toastLoading: false,
		data
	});
};

export const weeklyApi = (data) => {
	return request({
		url: `/api/member/video/view/member/weekly`,
		method: "POST",
		toastLoading: false,
		data
	});
};

// 获取指定视频的观看记录
export const videoLastApi = (data) => {
	return request({
		url: `/api/member/video/view/get/last/${data}`,
		method: "GET",
		toastLoading: false,
	});
};


// 周报汇总
export const getWeeklyAllApi = (data) => {
	return request({
		url: `/api/member/video/view/member/weekly`,
		method: "POST",
		toastLoading: false,
		data
	});
};

// 获取客服二维码
export const getCode = (data) => {
	return request({
		url: `/api/manage/file/list`,
		method: "POST",
		data,
		toastLoading: false,
	});
};